import { Navigate } from 'react-router-dom'

const isAuth = () => {
  const token = localStorage.getItem('token')
  console.log('token', token)
  return token
}

export default function Auth({ children }) {
  if (!isAuth()) {
    return <Navigate to='/login' />
  }
  return children
}
